/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mindwave.theoracle;

import java.awt.Color;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 *
 * @author MarcoJ
 */
public class Immagini  {
  
    Runnable Classe;
    
    public boolean getStatus(int i){
        
        switch (i){
            case 1: return ((Immagini1)this.Classe).getStatus();
            case 2: return ((Immagini2)this.Classe).getStatus();
        }
         return false;       
    }
    
  public Immagini(int img,int width, int height){
        switch (img){
         case 1: this.Classe = new Immagini1(width,height);
             break;
         case 2: this.Classe = new Immagini2(width,height);
             break;             
         case 3: this.Classe = new Immagini3(width,height);    
             break;
         case 4: this.Classe = new Immagini4(width,height);
             break;
                     
        }
                
    }
    
}


class Immagini1 implements Runnable {
    
    private int width;
    private int height;
    private boolean status;

    public boolean getStatus() {
        return status;
    }
    public Immagini1(int width, int height){
     this.height = height;
      this.width = width;
  }  
    
  public void run(){
    
    status = false;
    JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(width, height);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    JPanel orac= new JPanel();
    orac.setBackground(Color.white);
    orac.setBounds(0,0, width, height);
    orac.setLayout(null);
    frame.add(orac);
    int widthimage=(width/2);
    Icon image1 = new ImageIcon(getClass().getResource("images/immagine1.jpg"));
    JLabel Limage1 = new JLabel(image1);
    orac.add(Limage1);
    Limage1.setBounds((widthimage-105),(height/2),210,210);
     try {    
            Thread.sleep(2000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Immagini2.class.getName()).log(Level.SEVERE, null, ex);
        }
    frame.dispose();
    status = true;       
        
    }
}


class Immagini2 implements Runnable {
    
  private int width;
  private int height;
  private boolean status = false;

    public boolean getStatus() {
        return status;
    }
  
  public Immagini2(int width, int height){
      this.height = height;
      this.width = width;
  }  
    
  public void run(){
     
    status = false;  
    JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(width, height);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    JPanel orac= new JPanel();
    orac.setBackground(Color.white);
    orac.setBounds(0,0, width, height);
    orac.setLayout(null);
    frame.add(orac);
    int widthimage=(width/2);
    Icon image2 = new ImageIcon(getClass().getResource("images/immagine2.jpg"));
    JLabel Limage2 = new JLabel(image2);
    orac.add(Limage2);
    Limage2.setBounds((widthimage-105),(height/2),210,210);
        try {    
            Thread.sleep(2000);
        } catch (InterruptedException ex) {
            Logger.getLogger(Immagini2.class.getName()).log(Level.SEVERE, null, ex);
        }
    frame.dispose();    
    status = true;       
    
    }
    
}

 class Immagini3 implements Runnable {
     
  private int width;
  private int height;
  
  public Immagini3(int width, int height){
      this.height = height;
      this.width = width;
  }  
    
  public void run(){
      
    JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(width, height);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    JPanel orac= new JPanel();
    orac.setBackground(Color.white);
    orac.setBounds(0,0, width, height);
    orac.setLayout(null);
    frame.add(orac);
    int widthimage=(width/2);
    Icon image3 = new ImageIcon(getClass().getResource("images/immagine3.jpg"));
    JLabel Limage3 = new JLabel(image3);
    orac.add(Limage3);
    Limage3.setBounds((widthimage-105),(height/2),210,210);
        
    }
    
}

 class Immagini4 implements Runnable {
     
     private int width;
  private int height;
  
  public Immagini4(int width, int height){
      this.height = height;
      this.width = width;
  }  
    
  public void run(){
   
    System.out.println("4");  
    JFrame frame = new JFrame();
    frame.setUndecorated(true);
    frame.setSize(width, height);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    JPanel orac= new JPanel();
    orac.setBackground(Color.white);
    orac.setBounds(0,0, width, height);
    orac.setLayout(null);
    frame.add(orac);
    int widthimage=(width/2);
    Icon image4 = new ImageIcon(getClass().getResource("images/immagine4.jpg"));
    JLabel Limage4 = new JLabel(image4);
    orac.add(Limage4);
    Limage4.setBounds((widthimage-105),(height/2),210,210);
    }
    
}